<input type="hidden" id="new_album_status" value="<?php echo $this->session->flashdata('new_album_status'); ?>" />
<input type="hidden" id="update_album_status" value="<?php echo $this->session->flashdata('update_album_status'); ?>" />
<input type="hidden" id="album_album_id" value="<?php echo $this->session->flashdata('album_album_id'); ?>" />
<input type="hidden" id="album_album_hash" value="<?php echo $this->session->flashdata('album_album_hash'); ?>" />
<script type="text/javascript">
  $(document).ready(function() {
    $("img.album_item_thumb").lazy();
    var sb_conf = {
      gallery: "innoTweets Gallery",
      continuous: true,
      counterType: "skip",
      slideshowDelay: "5"
    };
    Shadowbox.setup("a.inno_album", sb_conf);
    var new_album_status = $.trim($('#new_album_status').val());
    if (new_album_status == 1) {
      toastr.success('Successfully created album !');
    }
    if (new_album_status == 2) {
      toastr.error('Error occured. Try again !');
    }
    var update_album_status = $.trim($('#update_album_status').val());
    if (update_album_status == 1) {
      toastr.success('Successfully updated album !');
    }
    if (update_album_status == 2) {
      toastr.error('Error occured. Try again !');
    }
    var album_album_id = $.trim($('#album_album_id').val());
    var album_album_hash = $.trim($('#album_album_hash').val());
    if ((album_album_id) && (album_album_hash)) {
      send_notification('new_album', album_album_id, album_album_hash);
    }
    update_likes_count();
  });
  function start_slideshow() {
    var photos_count = $.trim($('#photos_count').val());
    if (photos_count >= 1) {
      Shadowbox.open(document.getElementById('mygallery'));
    } else {
      toastr.info('No photos to slideshow !');
    }
  }
</script>
<div class="page" style="min-height: 500px;">
  <div class="page-container">
    <div class="container">
      <div class="row">
        <div class="span12 header">
          <div class="btn-group" style="float: right; margin-bottom: 10px;">
            <a onclick="return start_slideshow();" class="btn btn-primary">SlideShow</a>
            <?php if (($album_data['user_id'] == $this->current_user['user_id']) || ($this->is_admin)) { ?>
              <a href="<?php echo base_url('album/update/' . $album_id); ?>" class="btn">Update</a>
              <a onclick="return confirm_action('Delete this album ?')" href="<?php echo base_url('album/delete/' . $album_id); ?>" class="btn">Delete</a>
            <?php } ?>
          </div>
          <span style="float: right; margin-right: 10px;">
            <?php $get_user_like_status = get_user_like_status('album', $album_data['album_id']); ?>
            <?php if ($get_user_like_status['status'] == 'yes') { ?>
              <a title="Unlike" style="text-decoration: none; cursor: pointer; color: yellowgreen;" id="like_button_album_<?php echo $album_data['album_id']; ?>" onclick="return do_like_action('album', '<?php echo $album_data['album_id']; ?>', '0');"><i class="icon-large icon-thumbs-down"></i></a>
            <?php } else { ?>
              <a title="Like" style="text-decoration: none; cursor: pointer; color: yellowgreen;" id="like_button_album_<?php echo $album_data['album_id']; ?>" onclick="return do_like_action('album', '<?php echo $album_data['album_id']; ?>', '1');"><i class="icon-large icon-thumbs-up"></i></a>
            <?php } ?>
          </span>
          <a class="update_like_count" title="Show users who like this" onclick="return show_liked_users('album', '<?php echo $album_data['album_id']; ?>');" style="text-decoration: none; color: #777; float: right; margin-right: 10px; cursor: pointer;" id="like_count_album_<?php echo $album_data['album_id']; ?>"><?php echo $get_user_like_status['total_count']; ?> Likes</a>
          <span style="font-size: 20px; font-weight: bold; word-break: break-all;"><?php echo $album_data['album_name']; ?></span>
          &nbsp;By&nbsp;
          <b><a style="text-decoration: none;" href="<?php echo base_url('profile/' . $album_data['user_name']); ?>"><?php echo $album_data['user_display_name']; ?></a></b>
        </div>
        <div class="span">
          <?php if (!empty($album_data['album_photos']) && is_array($album_data['album_photos'])) { ?>
            <ul class="grid">
              <?php $ph_count = 0; ?>
              <?php foreach ($album_data['album_photos'] as $album_photo) { ?>
                <?php if ($album_photo['photo_video_type'] == 1) { ?>
                  <?php $ph_count++; ?>
                  <li>
                    <a title="<?php echo $album_photo['photo_likes_count']; ?> Likes & <?php echo $album_photo['photo_comments_count']; ?> Comments" href="<?php echo site_url('album/photo/' . $album_photo['photo_id']); ?>">
                      <img class="album_item_thumb" src="<?php echo base_url('assets/img/loading_black.gif'); ?>" data-src="<?php echo base_url('assets/albums/' . $album_data['album_id'] . '/' . substr($album_photo['photo_file'], 0, 32) . '_thumb.jpg'); ?>">
                    </a>
                  </li>
                  <div style="display: none;">
                    <?php if ($ph_count == 1) { ?>
                      <a title-sb="<a target='_blank' style='color: white; text-decoration:none; cursor: pointer;' href='<?php echo site_url('album/photo/' . $album_photo['photo_id']); ?>'><?php echo $album_photo['photo_likes_count']; ?> Likes | <?php echo $album_photo['photo_comments_count']; ?> Comments <?php echo ($album_photo['photo_desc']) ? '| ' . character_limiter($album_photo['photo_desc'], 50) : ''; ?></a>" rel="inno_album" class="inno_album" id="mygallery" href="<?php echo base_url('assets/albums/' . $album_data['album_id'] . '/' . $album_photo['photo_file']); ?>">
                        <?php echo $album_photo['photo_id']; ?>
                      </a>
                    <?php } else { ?>
                      <a title-sb="<a target='_blank' style='color: white; text-decoration:none; cursor: pointer;' href='<?php echo site_url('album/photo/' . $album_photo['photo_id']); ?>'><?php echo $album_photo['photo_likes_count']; ?> Likes | <?php echo $album_photo['photo_comments_count']; ?> Comments <?php echo ($album_photo['photo_desc']) ? '| ' . character_limiter($album_photo['photo_desc'], 50) : ''; ?></a>" rel="inno_album" class="inno_album" href="<?php echo base_url('assets/albums/' . $album_data['album_id'] . '/' . $album_photo['photo_file']); ?>">
                        <?php echo $album_photo['photo_id']; ?>
                      </a>
                    <?php } ?>
                  </div>
                <?php } ?>
                <?php if ($album_photo['photo_video_type'] == 2) { ?>
                  <li>
                    <a title="<?php echo $album_photo['photo_likes_count']; ?> Likes & <?php echo $album_photo['photo_comments_count']; ?> Comments" href="<?php echo site_url('album/video/' . $album_photo['photo_id']); ?>">
                      <img class="album_item_thumb" src="<?php echo base_url('assets/img/loading_black.gif'); ?>" data-src="<?php echo base_url('assets/albums/' . $album_data['album_id'] . '/' . substr($album_photo['photo_file'], 0, 32) . '_thumb.jpg'); ?>">
                      <i class="icon-large icon-film" style="position: absolute; margin-left: -47px;"></i>
                    </a>
                  </li>
                <?php } ?>
              <?php } ?>
            </ul>
            <input type="hidden" name="photos_count" id="photos_count" value="<?php echo $ph_count; ?>"/>
          <?php } else { ?>
            No photos / videos !
          <?php } ?>
        </div>

        <!-- Comments Section start -->
        <div class="span12 header">
          <h4>Recent comments on photos / videos</h4>
        </div>
        <div class="span12">
          <div class="messages">
            <?php if (!empty($album_photos_comments)) { ?>
              <?php foreach ($album_photos_comments as $comment) { ?>
                <?php if ($comment['photo_video_type'] == 1) { ?>
                  <a style="float: left; margin-right: 10px;" href="<?php echo site_url('album/photo/' . $comment['photo_id']); ?>">
                    <img class="img-rounded pull-left" style="width: 60px; height: 60px; max-width: 60px; max-height: 60px;" src="<?php echo base_url('assets/albums/' . $album_data['album_id'] . '/' . substr($comment['photo_file'], 0, 32) . '_thumb.jpg'); ?>">
                  </a>
                <?php } ?>
                <?php if ($comment['photo_video_type'] == 2) { ?>
                  <a style="float: left; margin-right: 10px;" href="<?php echo site_url('album/video/' . $comment['photo_id']); ?>">
                    <img class="img-rounded pull-left" style="width: 60px; height: 60px; max-width: 60px; max-height: 60px;" src="<?php echo base_url('assets/albums/' . $album_data['album_id'] . '/' . substr($comment['photo_file'], 0, 32) . '_thumb.jpg'); ?>">
                  </a>
                <?php } ?>
                <div class="message" id="comment_<?php echo $comment['comment_id']; ?>">
                  <a href="<?php echo base_url('profile/' . $comment['user_name']); ?>"><img title="<?php echo $comment['user_display_name']; ?>" src="<?php echo base_url('assets/photos/' . $comment['user_image']); ?>" class="img-rounded pull-left" style="max-height: 60px; max-width: 60px;"/></a>
                  <div class="message-body">
                    <p class="pull-right">
                      <a style="text-decoration: none; cursor: pointer; color: salmon;" href="#comment_<?php echo $comment['comment_id']; ?>">&nbsp;&nbsp;#C<?php echo $comment['comment_id']; ?></a>
                    </p>
                    <p class="pull-right">&nbsp;(<?php echo time_ago($comment['comment_date']); ?> ago)</p>
                    <span style="float: right; margin-right: 10px;">
                      <?php $get_user_like_status = get_user_like_status('comment', $comment['comment_id']); ?>
                      <?php if ($get_user_like_status['status'] == 'yes') { ?>
                        <a title="Unlike" style="text-decoration: none; cursor: pointer; color: yellowgreen;" id="like_button_comment_<?php echo $comment['comment_id']; ?>" onclick="return do_like_action('comment', '<?php echo $comment['comment_id']; ?>', '0');"><i class="icon-large icon-thumbs-down"></i></a>
                      <?php } else { ?>
                        <a title="Like" style="text-decoration: none; cursor: pointer; color: yellowgreen;" id="like_button_comment_<?php echo $comment['comment_id']; ?>" onclick="return do_like_action('comment', '<?php echo $comment['comment_id']; ?>', '1');"><i class="icon-large icon-thumbs-up"></i></a>
                      <?php } ?>
                    </span>
                    <a class="update_like_count" title="Show users who like this" onclick="return show_liked_users('comment', '<?php echo $comment['comment_id']; ?>');" style="text-decoration: none; color: #777; float: right; margin-right: 10px; cursor: pointer;" id="like_count_comment_<?php echo $comment['comment_id']; ?>"><?php echo $get_user_like_status['total_count']; ?> Likes</a>
                    <div style="margin-left: 65px;">
                      <h5>
                        <?php echo $comment['user_display_name']; ?>
                        &nbsp;
                        <span style="color: #777; font-size: smaller;">(@<?php echo $comment['user_name']; ?>)</span>
                        &nbsp;
                        <?php if (is_online($comment['user_id'])) { ?>
                          <img src="<?php echo site_url('assets/img/online_button_tiny.png'); ?>" title="Online"/>
                        <?php } else { ?>
                          <img src="<?php echo site_url('assets/img/offline_button_tiny.png'); ?>" title="Offline"/>
                        <?php } ?>
                      </h5>
                      <p style="word-break: normal;"><?php echo nl2br(parse_smileys($comment['comment_message'], base_url('assets/smileys'))); ?></p>
                    </div>
                  </div>
                </div>
              <?php } ?>
            <?php } else { ?>
              No comments on photos / videos !
            <?php } ?>
          </div>
        </div>
        <!-- Comments Section end -->

      </div>
    </div>
  </div>
</div>